package com.itheima.controller;

import com.itheima.service.mongo.FriendService;
import com.itheima.vo.PageBeanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/friend")
public class FriendController{

    @Autowired
    private FriendService friendService;

    @PostMapping("/save")
    public void save(Long userId, Long friendId) {
        friendService.save(userId,friendId);
    }

    @GetMapping("/findByUserId")
    public PageBeanVo findByUserId(Long userId, Integer pageNum, Integer pageSize) {
        return friendService.findByUserId(userId, pageNum, pageSize);
    }

    @DeleteMapping("/delete")
    public void delete(Long userId, Long friendId) {
        friendService.delete(userId, friendId);
    }
}
